#include "widget4.h"
#include "ui_widget4.h"

Widget4::Widget4(FlightBookingSystem& system,Widget *las,Flight &f,QWidget *parent)
    :bookingSystem(system),
    last(las),
    flight(f),
    QWidget(parent),
    ui(new Ui::Widget4)
{
    ui->setupUi(this);
}

Widget4::~Widget4()
{
    delete ui;
}

void Widget4::on_pushButton_cancel_clicked()
{
    emit this->back();
}


void Widget4::on_pushButton_determine_clicked()
{
    this->close();
    // 判断能否修改航班数据(可修改的航班数据没有乘客订票）
    if(bookingSystem.ismodifyFlights(flight.flightNumber, flight.airplaneNumber)){
        this->page4_1=new Form4_1(last,flight,bookingSystem);
        this->page4_1->show();
    }
}


void Widget4::on_lineEdit1_textChanged(const QString &arg1)
{
    string s=arg1.toStdString();
    this->flight.flightNumber=s;
}


void Widget4::on_lineEdit2_textChanged(const QString &arg1)
{
    string s=arg1.toStdString();
    this->flight.airplaneNumber=s;
}

